package com.hwl.demo19;

import com.hwl.demo19.entity.Request;
import com.hwl.demo19.service.Manager;
import com.hwl.demo19.service.impl.CommonManager;
import com.hwl.demo19.service.impl.Director;
import com.hwl.demo19.service.impl.GeneralManager;

/**
 * 职责链模式
 *
 * @author sentry
 * @since 2023-03-26
 */
public class Main {

    public static void main(String[] args) {
        Manager manager = new CommonManager("金利");
        Manager director = new Director("宗剑");
        Manager generalManager = new GeneralManager("钟精励");
        manager.setSuperior(director);
        director.setSuperior(generalManager);

        Request request = new Request();
        request.setRequestType("请假");
        request.setRequestContent("小菜请假");
        request.setNumber(1);
        manager.requestApplications(request);

        Request request1 = new Request();
        request1.setRequestType("请假");
        request1.setRequestContent("小菜请假");
        request1.setNumber(4);
        manager.requestApplications(request1);

        Request request2 = new Request();
        request2.setRequestType("加薪");
        request2.setRequestContent("小菜请求加薪");
        request2.setNumber(5000);
        manager.requestApplications(request2);

        Request request3 = new Request();
        request3.setRequestType("加薪");
        request3.setRequestContent("小菜请求加薪");
        request3.setNumber(7000);
        manager.requestApplications(request3);
    }
}
